# -*- coding: utf-8 -*-
from datetime import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt


if __name__ == '__main__':
    series_obj = pd.Series(np.random.randn(1000), index=pd.date_range("20170101", periods=1000))
    print series_obj.head()
    rolling = series_obj.rolling(window=5)
    print rolling
    print "-------第五天的数据是前五天数据的均值----------------------"
    print rolling.mean()
    print '--------------------------------------'
    plt.figure(figsize=(15, 5))
    series_obj.plot(style="r--")
    # series_obj.rolling(window=10).mean().plot(style="b")
    # series_obj.rolling(window=10, center=True).mean().plot(style="b")
    series_obj.rolling(window=10, center=True).sum().plot(style="b")
    plt.show()
